{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "V1: [[-0.61912751  0.10767912]]\n",
      "V2: [[ 0.10039134 -1.51745009 -0.61548245]\n",
      " [ 0.6146487   0.66980863 -1.00977123]]\n",
      "Model saved in file:  save/model.ckpt\n"
     ]
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "\n",
    "v1 = tf.Variable(tf.random_normal([1,2]), name=\"v1\")\n",
    "v2 = tf.Variable(tf.random_normal([2,3]), name=\"v2\")\n",
    "init_op = tf.global_variables_initializer()\n",
    "saver = tf.train.Saver()\n",
    "with tf.Session() as sess:\n",
    "    sess.run(init_op)\n",
    "    print (\"V1:\",sess.run(v1))  \n",
    "    print (\"V2:\",sess.run(v2))\n",
    "    saver_path = saver.save(sess, \"save/model.ckpt\")\n",
    "    print (\"Model saved in file: \", saver_path) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "V1: [[-0.61912751  0.10767912]]\n",
      "V2: [[ 0.10039134 -1.51745009 -0.61548245]\n",
      " [ 0.6146487   0.66980863 -1.00977123]]\n",
      "Model restored\n"
     ]
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "v1 = tf.Variable(tf.random_normal([1,2]), name=\"v1\")\n",
    "v2 = tf.Variable(tf.random_normal([2,3]), name=\"v2\")\n",
    "saver = tf.train.Saver()\n",
    "\n",
    "with tf.Session() as sess:\n",
    "    saver.restore(sess, \"save/model.ckpt\")\n",
    "    print (\"V1:\",sess.run(v1))  \n",
    "    print (\"V2:\",sess.run(v2))\n",
    "    print (\"Model restored\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
